﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Mvc;
namespace XToolKit.Mvc.Internal
{
    /// <summary>
    /// 打酱油的类，重构时会取消
    /// </summary>
    static class HttpContextBaseExtensions
    {
        public static string GetClientIpAddress(this HttpContextBase httpContext)
        {
            return httpContext.Request.UserHostAddress;
        }

        public static string GetClientId(this HttpContextBase httpContext)
        {
            return httpContext.Session.SessionID;
        }

        public static MvcUser GetCurrentUser(this HttpContextBase httpContext)
        {
            return new NonAuthorizedUser(httpContext.GetClientId(), httpContext.GetClientIpAddress());
        }

    }
}
